home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / 40int24.zip / INT24.DOC next >
Text File  |  1988-01-02  |  4KB  |  86 lines

  1. (* INT24  --  A unit for trapping DOS critical errors (INT 24) for retries.
  2.  
  3.   Version 1.01 - 01/02/1987 - First general release
  4.  
  5.   Scott Bussinger
  6.   Professional Practice Systems
  7.   110 South 131st Street
  8.   Tacoma, WA  98444
  9.   (206)531-8944
  10.   Compuserve 72247,2671
  11.  
  12.   Turbo Pascal version 4.0 added a paticularily nice feature in that it
  13. automatically installs a critical error handler (INT 24) to keep DOS from
  14. putting up the familiar 'Abort, Retry, Ignore?' messages.  Instead of putting
  15. a message in the middle of your nice screens, you can now detect the errors
  16. and act on them yourself.  Unfortunately, you've also lost the ability to retry
  17. an error and let execution continue after fixing the problem without lots of
  18. programming effort.  This UNIT provides a special handler to display an error
  19. message on critical errors and allow the user to attempt to correct the
  20. problem and try it again.  If the user decides not to retry it, the program
  21. returns the normal error codes for critical errors.  The unit automatically
  22. saves the users screen so that the error message doesn't mess up any screen
  23. displays.  To include this unit in your program, add Int24 to the USES clause
  24. in your main program.
  25.   In general, when a critical error occurs, the INT24 unit first saves a copy
  26. of the users screen.  It thens blanks the screen, warbles at the user and
  27. displays an error message in the middle that explains what happened and waits
  28. for the user to hit a key.  If 'A', 'Q', ^C, Esc or ^Break is hit, the screen
  29. is restored and an error code is returned to the program.  If any other key is
  30. hit, the screen is displayed and the operation tried again.  If the error has
  31. not been corrected, the message will appear again.
  32.   The unit also allows you to install a special critical error handler in
  33. addition to the default handler in case you want to check for special cases
  34. on an individual basis (e.g. to not allow retries on write-protect errors).
  35.   This demonstration program requires some special routines to play with the
  36. cursor and write directly to the screen.  You must either use Brian Foley's
  37. FASTWR unit and my own CURSORS unit (both of these public domain packages are
  38. available on Compuserve) or use the TPCrt unit from Turbo Power Software's
  39. Turbo Professional package (Turbo Power Software can be reached in CA at
  40. (408)438-8608).  The program uses conditional compilation to choose between
  41. the two alternatives.  To use with the Turbo Professional routines include a
  42.         {$DEFINE TPROF}
  43. line at the beginning of the INT24 unit before compiling.
  44.  
  45.   If you compile this file, the resulting program will attempt to create a
  46. file on drive A.  Try leaving the disk out and running the program.  Then try
  47. it with a disk in.  Now try it with a disk with a write-protect tab
  48. attached.  Try both continuing without fixing the problem and then try
  49. aborting by hitting ^C.  Now run the program again (still with the write-
  50. protect tab) and remove the disk before hitting the key.  Then one last time
  51. removing the write-protect tab when the program suggests it. *)
  52.  
  53.  
  54. program Test;
  55.  
  56. uses Int24;
  57.  
  58. {$I-}
  59.  
  60. var I: Integer;
  61.  
  62. procedure FileTest;
  63.   var F: file;
  64.   begin
  65.   writeln('Testing for critical errors by writing to drive A:');
  66.   I := IOResult;
  67.   assign(F,'A:FILE');
  68.   I := IOResult;
  69.   rewrite(F);
  70.   I := IOResult;
  71.   if I <> 0
  72.    then
  73.     writeLn('Create failure on A:FILE :  IOResult=',I)
  74.    else
  75.     begin
  76.     writeln('A:FILE created.');
  77.     I := IOResult;
  78.     close(F);
  79.     I := IOResult
  80.     end
  81.   end;
  82.  
  83. begin
  84. FileTest
  85. end.
  86.